/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lostreseditores.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author DILOVE
 */
@Entity
@Table(name = "categoria_examen")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CategoriaExamen.findAll", query = "SELECT c FROM CategoriaExamen c"),
    @NamedQuery(name = "CategoriaExamen.findByIdCategoriaExm", query = "SELECT c FROM CategoriaExamen c WHERE c.idCategoriaExm = :idCategoriaExm"),
    @NamedQuery(name = "CategoriaExamen.findByDescripcion", query = "SELECT c FROM CategoriaExamen c WHERE c.descripcion = :descripcion")})
public class CategoriaExamen implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_categoria_exm")
    private Integer idCategoriaExm;
    @Size(max = 255)
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(mappedBy = "idcategoria")
    private List<Tipoexamen> tipoexamenList;

    public CategoriaExamen() {
    }

    public CategoriaExamen(Integer idCategoriaExm) {
        this.idCategoriaExm = idCategoriaExm;
    }

    public Integer getIdCategoriaExm() {
        return idCategoriaExm;
    }

    public void setIdCategoriaExm(Integer idCategoriaExm) {
        this.idCategoriaExm = idCategoriaExm;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<Tipoexamen> getTipoexamenList() {
        return tipoexamenList;
    }

    public void setTipoexamenList(List<Tipoexamen> tipoexamenList) {
        this.tipoexamenList = tipoexamenList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategoriaExm != null ? idCategoriaExm.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoriaExamen)) {
            return false;
        }
        CategoriaExamen other = (CategoriaExamen) object;
        if ((this.idCategoriaExm == null && other.idCategoriaExm != null) || (this.idCategoriaExm != null && !this.idCategoriaExm.equals(other.idCategoriaExm))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.lostreseditores.modelo.CategoriaExamen[ idCategoriaExm=" + idCategoriaExm + " ]";
    }
    
}
